home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
dev_libs
/
feelin040718
/
sources
/
gauge
/
prefs.c
< prev
next >
Wrap
C/C++ Source or Header
|
2004-08-03
|
4KB
|
144 lines
#include "Private.h"
#define DEF_GAUGE_BACK NULL
#define DEF_GAUGE_FRAME "0:12.0"
#include <proto/exec.h>
#define SysBase FeelinBase -> SYS
/*** Private ***************************************************************/
///VLabel_
FObject VLabel_(STRPTR Name)
{
return TextObject,
FA_SetMax, FV_SetMaxH,
FA_ChainToCycle, FALSE,
FA_Text, Name,
FA_Text_HCenter, TRUE,
End;
}
//+
/*** Methods ***************************************************************/
///p_Gauge_New
F_METHOD(ULONG,p_Gauge_New)
{
struct p_LocalObjectData *LOD = F_LOD(Class,Obj);
LOD -> AreaData = (FAreaData *) F_Get(Obj,FA_AreaData);
LOD -> Val = 1;
LOD -> SignalHandler.Object = Obj;
LOD -> SignalHandler.Method = FM_Gauge_Update,
LOD -> SignalHandler.Flags = FF_SignalHandler_Timer;
LOD -> SignalHandler.fsh_Secs = 0;
LOD -> SignalHandler.fsh_Micros = 30000;
return F_SuperDo(Class,Obj,Method,
FA_ChainToCycle, FALSE,
FA_Group_Title, "Gauge",
Child, ColGroup(2),
Child, LOD -> g_frame = PopFrameObject, End,
Child, LOD -> g_back = PopImageObject, End,
Child, VLabel_("Frame"),
Child, VLabel_("Back"),
End,
Child, VGroup, GroupFrame, FA_Frame_Title, "Example",
Child, LOD -> g_gauge = GaugeObject,
FA_Frame, "FP_Gauge_Frame",
FA_Back, "FP_Gauge_Back",
FA_Horizontal, TRUE,
FA_SetMax, FV_SetMaxH,
FA_ChainToCycle, FALSE,
"FA_Numeric_Max", 100,
End,
End,
TAG_MORE,Msg);
}
//+
///p_Gauge_Load
F_METHODM(void,p_Gauge_Load,FS_PreferenceGroup_Load)
{
struct p_LocalObjectData *LOD = F_LOD(Class,Obj);
ULONG data,
idFrm = F_DynamicFindID("FA_PopFrame_Spec"),
idImg = F_DynamicFindID("FA_PopImage_Spec");
data = F_Do(Msg -> Prefs,Msg -> id_Resolve,"FP_Gauge_Back", DEF_GAUGE_BACK); F_Set(LOD -> g_back, idImg,data);
data = F_Do(Msg -> Prefs,Msg -> id_Resolve,"FP_Gauge_Frame", DEF_GAUGE_FRAME); F_Set(LOD -> g_frame, idFrm,data);
}
//+
///p_Gauge_Save
F_METHODM(void,p_Gauge_Save,FS_PreferenceGroup_Save)
{
struct p_LocalObjectData *LOD = F_LOD(Class,Obj);
ULONG data,
idFrm = F_DynamicFindID("FA_PopFrame_Spec"),
idImg = F_DynamicFindID("FA_PopImage_Spec");
data = F_Get(LOD -> g_back, idImg); F_Do(Msg -> Prefs,Msg -> id_AddString, "FP_Gauge_Back", data);
data = F_Get(LOD -> g_frame, idFrm); F_Do(Msg -> Prefs,Msg -> id_AddString, "FP_Gauge_Frame",data);
}
//+
///p_Gauge_Show
F_METHOD(ULONG,p_Gauge_Show)
{
struct p_LocalObjectData *LOD = F_LOD(Class,Obj);
if (_render)
{
F_Do(_app,FM_Application_AddSignalHandler,&LOD -> SignalHandler);
}
return F_SUPERDO();
}
//+
///p_Gauge_Hide
F_METHOD(void,p_Gauge_Hide)
{
struct p_LocalObjectData *LOD = F_LOD(Class,Obj);
F_SUPERDO();
if (_render)
{
F_Do(_app,FM_Application_RemSignalHandler,&LOD -> SignalHandler);
}
}
//+
///p_Gauge_Update
F_METHOD(LONG,p_Gauge_Update)
{
struct p_LocalObjectData *LOD = F_LOD(Class,Obj);
LONG min,max,val;
F_Do(LOD -> g_gauge,FM_Get,
F_IDO(p_FA_Numeric_Min), &min,
F_IDO(p_FA_Numeric_Max), &max, TAG_DONE);
val = F_Do(LOD -> g_gauge,F_IDO(p_FM_Numeric_Increase),LOD -> Val);
// F_DebugOut("Val %ld - Min %ld - Max %ld\n",val,min,max);
if (val == min)
{
LOD -> Val = 1;
}
else if (val == max)
{
LOD -> Val = -1;
}
return TRUE; // If we return FALSE the timer event won't be requested again
}
//+